home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / bbbbs85.lha / rexx / OldEMail.rexx < prev    next >
OS/2 REXX Batch file  |  1992-06-29  |  2KB  |  85 lines

  1. /*   $VERS: 5.1 OldEmail.rexx 29 Jun 1992 (29.6.92)
  2. copyright 1992 Richard Lee Stockton FREELY DISTRIBUTABLE
  3.          Reports on old email and emailfiles.
  4. */
  5.  
  6. SAY 'Email may be deleted at any time without bad effects.'
  7. SAY 'Remember to delete the attached emailfile, too.'
  8. SAY
  9.  
  10. ARG days deleteflag .
  11. IF days<1 THEN
  12.   DO
  13.     SAY 'USAGE: rx OldEmail <days> [DELETE]'
  14.     SAY 'ie, ''rx OldEmail 90''  will report all email'
  15.     SAY 'and emailfiles that are more than 90 days old.'
  16.     SAY 'The DELETE keyword causes the old email to be displayed, then,'
  17.     SAY 'your approval is required for EACH deletion of email or files.'
  18.     EXIT
  19.   END
  20.  
  21. CALL PRAGMA('P',-2)   /* lower priority so no slowdown of BBS */
  22.  
  23. SAY 'Today is' DATE('W') DATE()
  24. SAY 'Reporting Email and EmailFiles more than' days 'days old...'
  25. testdate=DATE('I')-days
  26.  
  27. bbspath=GETCLIP('BBS_path')
  28. maildirs=SHOWDIR(bbspath'Email','D')
  29. filedirs=SHOWDIR(bbspath'EmailFiles','D')
  30.  
  31. DO i=1 TO WORDS(maildirs)
  32.   thisdir=WORD(maildirs,i)
  33.   mail=SHOWDIR(bbspath'Email/'thisdir,'F')
  34.   DO j=1 TO WORDS(mail)
  35.     thismail=WORD(mail,j)
  36.     thisfile=bbspath'Email/'thisdir'/'thismail
  37.     thisdate=WORD(STATEF(thisfile),5)
  38.     IF thisdate<testdate THEN
  39.       DO
  40.         SAY DATE(,thisdate,'I') thisfile
  41.         IF deleteflag='DELETE' THEN
  42.           DO
  43.             x=OPEN(f,thisfile,'R')
  44.             IF x=0 THEN ITERATE j
  45.             DO loop=1 WHILE ~EOF(f)
  46.               SAY READLN(f)
  47.               IF loop//18=0 THEN
  48.                 DO
  49.                   OPTIONS PROMPT 'Q=Quit  [RETURN]=Continue '
  50.                   PULL junk
  51.                   IF junk='Q' THEN LEAVE loop
  52.                 END
  53.             END
  54.             CALL CLOSE(f)
  55.             OPTIONS PROMPT 'Delete this email? (nY) > '
  56.             PULL temp
  57.             IF LEFT(temp,1)~='N' THEN CALL DELETE(thisfile)
  58.           END
  59.       END
  60.   END
  61. END
  62.  
  63. DO i=1 TO WORDS(filedirs)
  64.   thisdir=WORD(filedirs,i)
  65.   filz=SHOWDIR(bbspath'EmailFiles/'thisdir,'F')
  66.   DO j=1 TO WORDS(filz)
  67.     thisfile=bbspath'EmailFiles/'thisdir'/'WORD(filz,j)
  68.     thisdate=WORD(STATEF(thisfile),5)
  69.     IF thisdate<testdate THEN
  70.       DO
  71.         SAY DATE(,thisdate,'I') thisfile
  72.         IF deleteflag='DELETE' THEN
  73.           DO
  74.             OPTIONS PROMPT 'Delete this file? (nY) > '
  75.             PULL temp
  76.             IF LEFT(temp,1)~='N' THEN CALL DELETE(thisfile)
  77.           END
  78.       END
  79.   END
  80. END
  81.  
  82. SAY 'Done!'
  83.  
  84. /* OldEmail.rexx */
  85.